package com.example.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("/login")
public class LoginController {

    @RequestMapping("/index")
    public HashMap<String,String> login(@RequestBody String username,@RequestBody String password){
        HashMap<String,String> map=new HashMap<>();
        if(username!=null && password!=null&& username.equals("张三")&& password.equals("123")){
            map.put("msg","登录成功");
        }else{
            map.put("msg","用户名或密码错误");
        }
        return map;
    }
}
